<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
  <th:block th:include="include :: header('上传商品图片')"/>
  <th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
  <form class="form-horizontal m" id="form-image-add">
    <div class="form-group">
      <label class="font-noraml">上传商品图片</label>
      <div class="file-loading">
        <input id="uploadImage" type="file" multiple>
      </div>
    </div>
  </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-js" />
<script type="text/javascript">
  $(document).ready(function () {
    $("#uploadImage").fileinput({
      theme: 'explorer-fas',
      overwriteInitial: false,
      initialPreviewAsData: true,
      showCaption: false,
      // showBrowse: false,
      // showPreview: false,
      showRemove: false,
      showUpload: false,
      showCancel: false,
      showClose: false,
      uploadAsync: true,
      uploadUrl: '' + [[${product.productId}]],
      allowedFileTypes: [
        'image'
      ],
      layoutTemplates :{
        actionUpload:'',
        indicator:''
      }
    // }).on('filebatchselected', function (event, data, id, index) {
    //   $(this).fileinput("upload");
    // }).on("fileuploaded", function(event, data, previewId, index) {
    //   // if(data.response)
    //   // {
    //   //   alert('处理成功');
    //   // }
    });
  });

  function submitHandler() {

    $("#uploadImage").fileinput("upload");

    $.modal.reload();
    $.modal.close();
  }
</script>
</body>
</html>